package com.campus.common.message;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 订单取消消息
 * 用于Kafka消息传递，从商户端发送到顾客端
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class OrderCancelMessage implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 用户openId
     */
    private String openId;

    /**
     * 订单号
     */
    private String orderId;

    /**
     * 订单金额
     */
    private BigDecimal orderAmount;

    /**
     * 取消原因
     */
    private String cancelReason;

    /**
     * 消息创建时间戳
     */
    private Long timestamp;

    /**
     * 构造方法（不包含时间戳，自动设置为当前时间）
     */
    public OrderCancelMessage(String openId, String orderId, BigDecimal orderAmount, String cancelReason) {
        this.openId = openId;
        this.orderId = orderId;
        this.orderAmount = orderAmount;
        this.cancelReason = cancelReason;
        this.timestamp = System.currentTimeMillis();
    }
}